package org.lennon.compent.aliyun.rocketmq.starter.sampleexemple.processor;

import com.aliyun.openservices.shade.com.alibaba.fastjson.JSON;
import org.lennon.compent.aliyun.rocketmq.client.producer.AliyunRocketMQCommonProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.UUID;

/**
 * <p>
 *
 * </p>
 *
 * @author lennon
 * @date 2019-11-09 12:13 PM
 */
@RestController
public class TestController {

	@Resource
	private AliyunRocketMQCommonProducer aliyunRocketMQPersistentProducer;

	@GetMapping("/add")
	public String add() {
		aliyunRocketMQPersistentProducer.sendMessage(
				"test", "test", UUID.randomUUID().toString(), JSON.toJSONString(
					new TestDomain(1, "lennon")
				)
		);
		return "success";
	}
}
